<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
	<title>map</title>
	<style type="text/css">
	* {
		padding: 0;
		margin: 0;
	}
    </style>
</head>
<body>
	<div class="container">
		<h1>map</h1>
		<form action="" onsubmit="return post()">
		    接受协议:
		    <input type="checkbox" name="agreement" message="请接受接受协议" />
		    我是学生:
		    <input type="checkbox" name="student" message="网站只对学生开放" />
		    <input type="submit" />
		 </form>
	</div>
	<script src="index.js"></script>
	<script type="text/javascript">
		function post() {
			let map = new Map()
			document.querySelectorAll('[type=checkbox]').forEach((input) => {
				map.set(input, {
					message : input.getAttribute('message'),
					status: input.checked
				})
			})
			console.log(map)

			return [...map].every(([, config]) => {
				config.status || alert(config.message)
				return config.status
			})

		}

	</script>
</body>
</html>